home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / ntfs / common / macros.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-11  |  1.7 KB  |  57 lines

  1. /*
  2.  *  macros.h
  3.  *
  4.  *  Copyright (C) 1995 Martin von L÷wis
  5.  *  Copyright (C) 1996 RΘgis Duchesne
  6.  */
  7. #ifndef EOPNOTSUPP
  8. #define EOPNOTSUPP 95
  9. #endif
  10.  
  11. #define NTFS_FD(vol)            ((vol)->u.fd)
  12.  
  13. /* Linux */
  14. #ifdef NTFS_IN_LINUX_KERNEL
  15. #define NTFS_SB(vol)            ((struct super_block*)(vol)->sb)
  16. #define NTFS_SB2VOL(sb)         (&(sb)->u.ntfs_sb)
  17. #define NTFS_INO2VOL(ino)       (&((ino)->i_sb->u.ntfs_sb))
  18. #define NTFS_LINO2NINO(ino)     (&((ino)->u.ntfs_i))
  19. #else
  20. #define NTFS_SB(vol)            ((struct super_block*)(vol)->u.sb)
  21. #define NTFS_SB2VOL(sb)         ((ntfs_volume*)(sb)->u.generic_sbp)
  22. #define NTFS_INO2VOL(ino)       ((ntfs_volume*)((ino)->i_sb->u.generic_sbp))
  23. #define NTFS_LINO2NINO(ino)     ((ntfs_inode*)((ino)->u.generic_ip))
  24. #endif
  25.  
  26. /* BSD */
  27. #define NTFS_MNT(vol)           ((struct mount*)(vol)->u.sb)
  28. #define NTFS_MNT2VOL(sb)        ((ntfs_volume*)(sb)->mnt_data)
  29. #define NTFS_V2INO(ino)         ((ntfs_inode*)((ino)->v_data))
  30.  
  31. /* Classical min and max macros still missing in standard headers... */
  32. #ifndef min
  33. #define min(a,b)        ((a) <= (b) ? (a) : (b))
  34. #define max(a,b)        ((a) >= (b) ? (a) : (b))
  35. #endif
  36.  
  37. #define IS_MAGIC(a,b)           (*(int*)(a)==*(int*)(b))
  38. #define IS_MFT_RECORD(a)        IS_MAGIC((a),"FILE")
  39. #define IS_NTFS_VOLUME(a)       IS_MAGIC((a)+3,"NTFS")
  40. #define IS_INDEX_RECORD(a)      IS_MAGIC((a),"INDX")
  41.  
  42. /* 'NTFS' in little endian */
  43. #define NTFS_SUPER_MAGIC        0x5346544E
  44.  
  45. #define NTFS_AFLAG_RO           1
  46. #define NTFS_AFLAG_HIDDEN       2
  47. #define NTFS_AFLAG_SYSTEM       4
  48. #define NTFS_AFLAG_ARCHIVE      20
  49. #define NTFS_AFLAG_COMPRESSED   0x800
  50. #define NTFS_AFLAG_DIR          0x10000000
  51.  
  52. /*
  53.  * Local variables:
  54.  *  c-file-style: "linux"
  55.  * End:
  56.  */
  57.